<template>
  <td
    v-if="typeof props.component?.display == 'undefined' || props.component?.display === true"
    :class="['table-cell', props.component?.customClass]"
    :colspan="props.component.colSpan"
    :rowspan="props.component.rowSpan"
    :style="props.component?.style"
  >
    <template v-for="(component, componentIndex) in props.component?.formList ?? []" :key="componentIndex">
      <component :is="getComponentName(component?.formType ?? 'input')" :component="component">
        <template v-for="slot in Object.keys($slots)" #[slot]="component">
          <slot :name="slot" v-bind="component" />
        </template>
      </component>
    </template>
  </td>
</template>

<script setup>
import { getComponentName } from "@/components/MaForm/types/utils";

const props = defineProps({ component: Object });
</script>
